Previous Book Contents Book Index Next

Inside Macintosh: 3D Graphics Programming With QuickDraw 3D /
Chapter 17 - File Objects / File Objects Reference
Application-Defined Routines /


TQ3ObjectTraverseMethod

You can define a method to traverse a custom object and write its data and the data of any attached subobjects to a file.

typedef TQ3Status (*TQ3ObjectTraverseMethod) (
TQ3Object object, 
TQ3FileObject file);
object
A QuickDraw 3D object.
file
A file object.
DESCRIPTION
Your TQ3ObjectTraverseMethod method should perform a number of operations necessary to write the object specified by the object parameter, as well as any subobjects attached to it, to the file specified by the file parameter.

First, your traverse method should determine whether the specified object should be written to the file. It's possible that you won't want to write certain types of custom objects or certain types of data associated with a custom object. If you decide not to write the specified object and its subobjects to the file, your traverse method should return kQ3Success without calling any _Submit functions.

Next, you should calculate the size on disk of your custom object. This size must be aligned on a 4-byte boundary. Then you should retrieve whatever view state information you need to preserve. The state of the view is not valid in your custom object write method, but it is valid in your traverse method; if you need view state information in your write method, you can pass a temporary buffer to it.

Once you've preserved whatever view state information you need, you should submit your data by calling Q3View_SubmitWriteData. Then you should submit subobjects by calling the appropriate _Submit functions. You must call Q3View_SubmitWriteData before calling _Submit functions to submit any subobjects.

RESULT CODES
Your TQ3ObjectTraverseMethod function should return kQ3Success if it is successful and kQ3Failure otherwise.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996